#! /bin/bash
metal=("audjpy audusd chfjpy eurcad eurchf eurgbp eurjpy eurusd gbpchf gbpjpy gbpusd nzdjpy nzdusd usdcad usdchf usdjpy xagusd xauusd")
metalDir="/usr/local/src/jenkins/metal"
for forex in $metal
do
forex=$(echo $forex | tr '[a-z]' '[A-Z]')
    if [ ! -f "$metalDir/$forex.zip" ] ;then
        echo "$forex.zip doesn't exists."
    fi
    echo $forex
    wget -N -P $metalDir  http://www.forextester.com/data/files/$forex.zip
    echo $?
    if [ ! $? ];then
        echo "$forex download false";
    else
        unzip -o $metalDir/$forex.zip -d $metalDir/txt/
    fi
done
scp /usr/local/src/jenkins/metal/*.zip root@data.worryblog.com:/usr/local/src/jenkins/metal/